import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user';
Vue.use(Vuex)
const store = new Vuex.Store({
  state: {
    count: 5,
    date: 6,
    token: "",
  },
  //   定义修改state的方法

  mutations: {
    increment(state, a) {
      state.count = a;
    },
    setdata(state, value) {
      state.date = value;
    },
    logintk(state, value) {
      state.token = value;
    },
  },
  actions: {
    login(context, token) {
      // 把请求放在这里
      context.commit("logintk", token);
    },
  },
  getters: {
    newdate: (state) => new Date(state.date).getTime(),
  },
  modules:{
    user
  }
});
export default store;